<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>艺术品交易系统</title>
    <style>
        body {
            font-family: "Microsoft YaHei", sans-serif;
            background: #f8f9fa;
            margin: 0;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 50px auto;
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
        }
        .btn-group {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        button {
            padding: 12px 20px;
            background: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            transition: background 0.3s;
        }
        button:hover {
            background: #0056b3;
        }
        .user-info {
            text-align: center;
            margin-bottom: 20px;
            color: #666;
        }
        .logout-btn {
            background: #dc3545;
        }
        .logout-btn:hover {
            background: #bb2d3b;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>艺术品交易与溯源系统</h1>
        <div id="userStatus" class="user-info">
            请先登录
        </div>
        <div class="btn-group">
            <button id="loginBtn" onclick="location.href='login.html'">用户登录</button>
            <button id="registerBtn" onclick="location.href='register.html'">用户注册</button>
            <button onclick="location.href='artworks.html'">浏览艺术品</button>
            <button onclick="location.href='collection.html'">我的收藏</button>
            <button onclick="location.href='transactions.html'">我的订单</button>
            <button onclick="location.href='trace.html'">艺术品溯源</button>
            <button id="logoutBtn" class="logout-btn" style="display:none" onclick="logout()">退出登录</button>
        </div>
    </div>
    <script>
        // 检查登录状态
        const user = localStorage.getItem('userInfo');
        if (user) {
            const userInfo = JSON.parse(user);
            document.getElementById('userStatus').textContent = `当前登录：${userInfo.username}（${userInfo.user_role}）`;
            document.getElementById('loginBtn').style.display = 'none';
            document.getElementById('registerBtn').style.display = 'none';
            document.getElementById('logoutBtn').style.display = 'block';
        }

        function logout() {
            localStorage.removeItem('userInfo');
            location.reload();
        }
    </script>
</body>
</html>
